﻿using System;
using Autofac;
using ShuttleBus.Config;
using ShuttleBus.Serialization;

namespace ShuttleBus.Transports.AmazonSqs
{
    public static class ConfigurationExtensions
    {
        public static TransportConfiguration ForSqs(this Configuration configuration, int threadCount, int secondsToProcessMessage, Uri transportUri, string awsKey, string awsSecretKey, int maxRetries = 5, Serializer serializer = Serializer.Json)
        {
            var builder = new ContainerBuilder();
            builder.RegisterModule(new SqsModule(threadCount, transportUri, awsKey, awsSecretKey, secondsToProcessMessage, maxRetries, serializer));
            builder.Update(UnitOfWork.Instance.ApplicationContainer);

            return new TransportConfiguration();
        }
    }
}
